home *** CD-ROM | disk | FTP | other *** search
/ Commodore Free 18 / Commodore_Free_Issue_18_2008_Commodore_Computer_Club.d64 / t.aztec c < prev    next >
Text File  |  2023-02-26  |  7KB  |  214 lines

  1. u
  2. Aztec C for C64 & Time source code
  3. (C) Copyright 2008 Bill Buckels All
  4. Rights Reserved.
  5.  
  6. The TIME program for the C 64 contains
  7. a completely rewritten English Language
  8. version of an application that I
  9. originally developed & published for
  10. Apple IIe in 1991. The formal title of
  11. this program is "What Time Is It?".
  12.  
  13. The goal of the application is to
  14. teach Elementary School Children how
  15. to tell time. Regardless, my own goal
  16. in producing this program was to
  17. provide a full-blown application that
  18. demonstrates what a seasoned expert
  19. Programmer can do in the Aztec C
  20. Environment for the C 64.
  21.  
  22. Now if all you are in this for is run
  23. programs and not to make them the TIME
  24. directory like all my other program
  25. directories contains the finished
  26. programs including a disk image called
  27. time.d64. These programs are preloaded
  28. on the disk image and run nicely in
  29. the vice emulator. If you are using
  30. these in WinVICE remember that while
  31. graphics load quickly in Warp Mode,
  32. the sound routines are time-based and
  33. you should take your emulator out-of
  34. Warp Mode for proper sound playback
  35. and time-based events.
  36.  
  37. Introduction:
  38. If you are reading this but have not
  39. reviewed all of the samples and all
  40. the projects in this programming
  41. environment please do not be offended
  42. if most of this goes completely over
  43. your head, or worse yet sounds like a
  44. nattering old man (which it should if
  45. it's flying high enough, since that
  46. was my intent). Take comfort in the
  47. fact that I am giving you all the
  48. source code and graphics images that I
  49. used to produce the TIME application.
  50. All this is completely transparent.
  51. There are no trade secrets here and no
  52. TIME deadlines so take your TIME and
  53. enjoy the confusion because it's part
  54. of the game. It feels so good when you
  55. finally understand, for a moment...
  56. 'nuff said.
  57.  
  58. So let's get started and talk about
  59. the architecture and I am assuming
  60. that you have read the other make files
  61. & gained an understanding that memory
  62. management and mapping is "Job One".
  63.  
  64. Balancing the TIME Overlays:
  65. I really enjoyed this part. Some of
  66. you can imagine how I hurried through
  67. getting all my samples and library
  68. routines written and tested so I could
  69. actually do something more-or-less
  70. meaningful.
  71.  
  72. I wondered myself at times whether I
  73. would be able to fit all the stuff I
  74. needed to into memory. My work on this
  75. particular application on the Apple
  76. IIe using Aztec C was in the PRODOS
  77. 128K environment which allowed me To
  78. store data in auxiliary memory. Even
  79. in that environment which is about the
  80. same size in conventional memory as
  81. this one, I needed to break down the
  82. Apple IIe version of TIME into more
  83. overlays than I did here and to keep
  84. the graphics data in upper memory...
  85. an option I don't have here.
  86.  
  87. So when I did all this and it just
  88. barely fit I knew I could show the
  89. rest of you how far this can go
  90. without breaking, Like I said above;
  91. memory management and mapping is "Job
  92. One" and showing someone what can be
  93. done makes the job fun.
  94.  
  95. You should have already figured-out
  96. from my other programs that I have
  97. been playing around with program
  98. memory holes, and sticking data into
  99. bits of memory that I couldn't run my
  100. programs in.
  101.  
  102. This is the way we do it. You should
  103. also have figured-out by now that the
  104. linker outputs the code and data
  105. sizes, and that my make files can be
  106. redirected to disk file so you can
  107. review errors and do something about
  108. them, or to examine actual data and
  109. code size and adjust the memory usage
  110. until there is barely any wasted
  111. space.
  112.  
  113. When I do overlays I am always
  114. trading-off what to put into the main
  115. (root) module and what to link into
  116. the overlays. If the main module gets
  117. too bloated and the overlay wipes-out
  118. the upper ram the program will finish
  119. but never get back to the BASIC
  120. prompt. My goal is always to get the
  121. user back to the OS whether I program
  122. for Windows, Linux, MS-DOS, Apple IIe
  123. ProDOS, or the C64. One must therefore
  124. consider all the overlays at once and
  125. realize where one must put what and
  126. when to discard and when not to.
  127.  
  128. In making TIME fit into SPACE I
  129. created some pretty neat tools to help
  130. save memory, and kept the code that I
  131. could in the main module, and the code
  132. that I couldn't in the overlays.
  133.  
  134. I run-length encoded my graphics and
  135. re-used buffers as well. The C64 disk
  136. drive is notoriously slow, so it is
  137. bad enough that I needed to read these
  138. overlays from disk but it would have
  139. been much worse if I needed to read
  140. additional graphics from disk, or
  141. worse yet, to read more overlays (like
  142. I needed to on the Apple IIe).
  143.  
  144. My comments are pretty good in the
  145. TIME modules, but sorry kids, they are
  146. intended for experts. So become one
  147. yourself if you aren't already and
  148. read the code and the MAKEFILE and run
  149. the thing and have some fun with it.
  150.  
  151. 'Nuff Said on the balancing of
  152. overlays... some additional eulogies
  153. on the topic are in the TIME source
  154. code.
  155.  
  156. Using The Graphics and Sound Routines
  157. If you have looked at my graphics
  158. routines you know by now that I could
  159. have gone much further, but that was
  160. never my goal. I just wanted to have a
  161. little fun with this old compiler and
  162. show-off a little bit and leave the
  163. field wide-open for competition.
  164.  
  165. I also could have optimized a little
  166. further, or a lot further. But I
  167. already know where all this breaks and
  168. by now I think I got some of my
  169. money's worth back on my original
  170. purchase price in enjoyment.
  171.  
  172. Part of my goal was to showcase the
  173. B64NAT.LIB in all of this. I think
  174. that the C64 routines that I am
  175. leaving you with are better than what
  176. I did on the Apple. The sound is
  177. better of course and the game play is
  178. without doubt the same since the
  179. processor is the same. The memory
  180. saving technique of run length
  181. encoding can be taken further, but I
  182. kept it simple. Still, by comparison
  183. the C64 stuff is easily as robust as
  184. the Apple IIe equivalent of using
  185. bitmap graphics from upper memory. I
  186. am satisfied and can now leave this
  187. alone. So by all means change the
  188. code, and have some fun yourself.
  189.  
  190. My selection of multicolour mode was
  191. deliberate. The graphics are simple
  192. since I originally drew then for the
  193. Apple II to avoid aliasing which
  194. effectively puts them somewhere close
  195. the same coarse resolution as on the
  196. C64. There are strange considerations
  197. when comparing low resolution graphics
  198. on the IBM-PC and Apple IIe and C64
  199. which I have discussed in length in my
  200. Wikipedia articles etc. But the common
  201. denominator that I mostly went with
  202. was 4 Colors, and 2 of them being
  203. Black and White, with the other two
  204. mainly Red and Blue, & I will leave the
  205. rest for you to figure-out on your own.
  206.  
  207. Read the code, run the program and
  208. have fun!
  209.  
  210. Over and Out.
  211.  
  212. Bill Buckels February 25, 2008
  213.  
  214.